home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / contrib / xmu / bin / xmenu.pl next >
Encoding:
Perl Script  |  1991-10-06  |  2.9 KB  |  88 lines

  1. #!/usr3/bin/perl
  2. ################################################################################
  3. #
  4. # File:         xmenu.pl
  5. # RCS:          $Header: $
  6. # Description:  simple perl interface to the WINTERP-based menu server...
  7. # Author:       Richard Hess, Consilium
  8. # Created:      Sat Oct  5 23:49:59 1991
  9. # Modified:     Sat Oct  5 23:53:10 1991 (Niels Mayer) mayer@hplnpm
  10. # Language:     Perl
  11. # Package:      N/A
  12. # Status:       X11r5 contrib tape release
  13. #
  14. # WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  15. # XLISP version 2.1, Copyright (c) 1989, by David Betz.
  16. #
  17. # Permission to use, copy, modify, distribute, and sell this software and its
  18. # documentation for any purpose is hereby granted without fee, provided that
  19. # the above copyright notice appear in all copies and that both that
  20. # copyright notice and this permission notice appear in supporting
  21. # documentation, and that the name of Hewlett-Packard and David Betz not be
  22. # used in advertising or publicity pertaining to distribution of the software
  23. # without specific, written prior permission.  Hewlett-Packard and David Betz
  24. # make no representations about the suitability of this software for any
  25. # purpose. It is provided "as is" without express or implied warranty.
  26. #
  27. ################################################################################
  28.  
  29. # +---------------------------------------------------------------------------
  30. #  WHO:    Richard Hess                    CORP:   Consilium
  31. #  TITLE:  Staff Engineer                  VOICE:  [415] 691-6342
  32. #      [ X-SWAT Team:  Special Projects ]  USNAIL: 640 Clyde Court
  33. #  UUCP:   ...!uunet!cimshop!rhess                 Mountain View, CA 94043
  34. # +---------------------------------------------------------------------------
  35.  
  36. $heading = "Select Item" ;
  37. $key     =  777 ;
  38. $note    = "::Perl" ;
  39. $output  = "/tmp/.xmu_output" ;
  40. $server  = "/tmp/.xmu_server" ;
  41. $xpos    = "t" ;
  42. $ypos    = "nil" ;
  43.  
  44. eval "\$$1=\$2" while $ARGV[0] =~ /^(\w+)=(.*)/ && shift;
  45.  
  46. if (-e $server) { } else { print ":NoServer\n" ; exit ; }
  47.  
  48. if ($xpos eq "t") {
  49.     $ypos = "nil" ;
  50. }
  51.  
  52. $nargs = @ARGV ;
  53.  
  54. if ($nargs > 0) {
  55.     foreach $item (@ARGV) {
  56.     $item = sprintf("\"%s\"", $item) ;
  57.     }
  58.  
  59.     if ($heading eq "nil") {
  60.     system 'wl' , "-f" , "$server", "\(xmu_menu $key" , "nil \`\(" , @ARGV , "\) \"$note\"\)" ;
  61.     } else {            
  62.     system 'wl' , "-f" , "$server", "\(xmu_menu $key" , "\"$heading\" \`\(" , @ARGV , "\) \"$note\"\)" ;
  63.     }
  64. }
  65.  
  66. system 'wl' , "-f" , "$server", "\(xmu_popup $key $xpos $ypos \'GNU_cbk\)" ;
  67.  
  68. open(LOG, "<$output") ;
  69. $etime = time;
  70. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat(LOG) ;
  71.  
  72. while ($etime > $mtime) {
  73. select(undef,undef,undef,0.5);
  74. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat(LOG) ;
  75. }
  76.  
  77. while (-z LOG) {
  78. select(undef,undef,undef,0.5);
  79. }
  80.  
  81. while (read(LOG,$buf,256)) {
  82.     chop($buf) ;
  83.     print "$buf\n" ;
  84. }
  85. close(LOG) ;
  86.  
  87. # ----------<eof>
  88.